package Day5_07_29;

import java.lang.reflect.Type;

public class Number {
	private int num1;
	private int num2;
	
	public Number(int num1, int num2) {
		this.num1 = num1;
		this.num2 = num2;
	}

//单一职能原则，谁调用谁打印比较好。
	public int add() {
		return num1 + num2;
//		int addResult = num1 + num2;
//		System.out.println(num1 + "+" + num2 + "=" + addResult);
	}
	public int sub() {
		return num1 - num2;
//		int subResult = num1 - num2;
//		System.out.println(num1 + "-" + num2 + "=" + subResult);
	}
	public int multi() {
		return num1 * num2;
//		int multiResult = num1 * num2;
//		System.out.println(num1 + "*" + num2 + "=" + multiResult);
	}
	public double div() {
		return (double)num1 / num2;
//		double divResult =(double)num1 / num2;
//		System.out.println(num1 + "÷" + num2 + "=" + divResult);
	}

	@Override
	public String toString() {
		return "Number [num1=" + num1 + ", num2=" + num2 + "]";
	}
	
}
